package org.bpms.controller.admin;

import java.util.HashMap;
import java.util.Map;
import org.bpms.service.admin.LogService;
import com.jfinal.aop.Enhancer;
import com.jfinal.core.Controller;

/**
 * 系统操作日志控制器
 * @author hupei
 *
 */
public class LogController extends Controller {
	private LogService logService = Enhancer.enhance(LogService.class);
	
	/**
	 * 日志列表
	 */
	public void index(){
		String stime = getPara("stime" , "");
		String tabid = getPara("tabid");
		String etime = getPara("etime" , "");
		setAttr("stime", stime);
		setAttr("etime", etime);
		if (!stime.equals("")){
			stime = stime+" 00:00:00";
		}
		if (!etime.equals("")){
			etime = etime+" 00:00:00";
		}
		Map<String,Object> pagemap = new HashMap<String, Object>();
		Integer pageNumber = getParaToInt("pageCurrent", 1);//要访问第几页，默认1
		Integer pageSize = getParaToInt("pageSize", 15);//每页多少条数据，默认15
		String orderField = getPara("orderField", "ctime");//对什么字段排序，默认空字符串
		String orderDirection = getPara("orderDirection", "desc");//升序还是降序，默认升序
		logService.findAll(stime, etime, pageNumber, pageSize, 
				orderField, orderDirection, pagemap);
		setAttr("page",pagemap);
		setAttr("tabid", tabid);
		render("/admin/log/log.html");
	}
}
